
// Copyright (C) 2012 Luca Piccioni
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//  
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//  
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Xml;

namespace Derm.Xml.Collada
{
	/// <summary>
	/// The library_animations element declares a module of animation elements.
	/// </summary>
	public class ColladaLibraryAnimations : ColladaXmlSerializable
	{
		#region Constructors

		/// <summary>
		/// Construct a ColladaLibraryAnimations.
		/// </summary>
		/// <param name="parent">
		/// The parent element containing this ColladaLibraryAnimations.
		/// </param>
		public ColladaLibraryAnimations(ColladaXmlSerializable parent) : base(parent)
		{
			
		}

		#endregion
	}

	/// <summary>
	/// The library_animation_clips element declares a module of animation_clip elements.
	/// </summary>
	public class ColladaLibraryAnimationClips : ColladaXmlSerializable
	{
		#region Constructors

		/// <summary>
		/// Construct a ColladaLibraryAnimationClips.
		/// </summary>
		/// <param name="parent">
		/// The parent element containing this ColladaLibraryAnimationClips.
		/// </param>
		public ColladaLibraryAnimationClips(ColladaXmlSerializable parent) : base(parent)
		{
			
		}

		#endregion
	}

	/// <summary>
	/// The library_cameras element declares a module of camera elements.
	/// </summary>
	[DebuggerDisplay("Id=({Id}), Name=({Name}), Cameras.Count=({Cameras.Count})")]
	public class ColladaLibraryCameras : ColladaInstanceLibrary<ColladaCamera>
	{
		#region Constructors

		/// <summary>
		/// Construct a ColladaLibraryCameras.
		/// </summary>
		/// <param name="parent">
		/// The parent element containing this ColladaLibraryCameras.
		/// </param>
		public ColladaLibraryCameras(ColladaXmlSerializable parent) : base(parent)
		{
			
		}

		#endregion

		#region Collada Library Cameras Information

		/// <summary>
		/// The id attribute is a text string containing the unique identifier of this element.
		/// Tis value must be unique within the instance document. Optional attribute.
		/// </summary>
		public string Id;

		/// <summary>
		/// The name attribute is the text string name of this element. Optional attribute.
		/// </summary>
		public string Name;

		/// <summary>
		/// The library_cameras element may contain an asset element.
		/// </summary>
		public ColladaAsset Asset;

		/// <summary>
		/// There must be at least one camera element.
		/// </summary>
		[ColladaInstantiableCollectionAttribute]
		public List<ColladaCamera> Cameras = new List<ColladaCamera>();

		/// <summary>
		/// The extra element may appear any number of times.
		/// </summary>
		public List<ColladaExtra> Extras = new List<ColladaExtra>(); 

		#endregion

		#region ColladaXmlSerializable Overrides

		/// <summary>
		/// Read the attribute of the current XML serializable.
		/// </summary>
		/// <param name="xmlReader">
		/// A <see cref="XmlReader"/> used for reading XML element attributes.
		/// </param>
		/// <remarks>
		/// <para>
		/// This method is called only in the case there are effectively attributes on XML element. Don't expect that this
		/// method will be called even when the attributes count is zero. This is very important, since the design doesn't
		/// allow object initialization using this method.
		/// </para>
		/// </remarks>
		public override void ReadAttributes(XmlReader xmlReader)
		{
			if (xmlReader == null)
				throw new ArgumentNullException("xmlReader");

			string attribute;

			if ((attribute = xmlReader[ColladaAttributeId]) != null)
				Id = attribute;
			if ((attribute = xmlReader[ColladaAttributeName]) != null)
				Name = attribute;
		}

		/// <summary>
		/// Read an element of the current XML serializable.
		/// </summary>
		/// <param name="elementName">
		/// A <see cref="System.String"/> that specify the element name.
		/// </param>
		/// <param name="xmlReader">
		/// A <see cref="XmlReader"/> used for reading child element. It is positioned at the start element.
		/// </param>
		/// <remarks>
		/// <para>
		/// This method is responsible to read the start element of the nested element.
		/// </para>
		/// <para>
		/// This method is resposible to read all children elements till the corresponding end element, without reading it. In the
		/// case this condition is not satisfied, the XML parsing will be aborted.
		/// </para>
		/// </remarks>
		public override void ReadElement(string elementName, XmlReader xmlReader)
		{
			if (elementName == null)
				throw new ArgumentNullException("elementName");
			if (xmlReader == null)
				throw new ArgumentNullException("xmlReader");

			if (elementName == ColladaElementAsset) {
				Asset = new ColladaAsset(this);
				Asset.ReadXml(xmlReader);
			} else if (elementName == ColladaElementCamera) {
				ColladaCamera colladaCamera = new ColladaCamera(this);
				colladaCamera.ReadXml(xmlReader);
				Cameras.Add(colladaCamera);
			} else if (elementName == ColladaElementExtra) {
				XmlHelper.SkipXmlElement(xmlReader);
			} else
				base.ReadElement(elementName, xmlReader);
		}

		/// <summary>
		/// Collada 'library_cameras' attribute name (1.4).
		/// </summary>
		private const string ColladaAttributeId = "id";

		/// <summary>
		/// Collada 'library_cameras' attribute name (1.4).
		/// </summary>
		private const string ColladaAttributeName = "name";

		/// <summary>
		/// Collada 'library_cameras' child element name (1.4).
		/// </summary>
		private const string ColladaElementAsset = "asset";

		/// <summary>
		/// Collada 'library_cameras' child element name (1.4).
		/// </summary>
		private const string ColladaElementCamera = "camera";

		/// <summary>
		/// Collada 'library_cameras' child element name (1.4).
		/// </summary>
		private const string ColladaElementExtra = "extra";

		#endregion
	}

	/// <summary>
	/// The library_controllers element declares a module of controller elements.
	/// </summary>
	public class ColladaLibraryControllers : ColladaXmlSerializable
	{
		#region Constructors

		/// <summary>
		/// Construct a ColladaLibraryControllers.
		/// </summary>
		/// <param name="parent">
		/// The parent element containing this ColladaLibraryControllers.
		/// </param>
		public ColladaLibraryControllers(ColladaXmlSerializable parent) : base(parent)
		{
			
		}

		#endregion
	}

	/// <summary>
	/// The library_geometries element declares a module of geometry elements.
	/// </summary>
	public class ColladaLibraryGeometries : ColladaInstanceLibrary<ColladaGeometry>
	{
		#region Constructors

		/// <summary>
		/// Construct a ColladaLibraryGeometries.
		/// </summary>
		/// <param name="parent">
		/// The parent element containing this ColladaLibraryGeometries.
		/// </param>
		public ColladaLibraryGeometries(ColladaXmlSerializable parent) : base(parent)
		{
			
		}

		#endregion

		#region Library Geometries Information

		/// <summary>
		/// The id attribute is a text string containing the unique identifier of this element.
		/// This value must be unique within the instance document. Optional attribute.
		/// </summary>
		public string Id;

		/// <summary>
		/// The name attribute is the text string name of this element. Optional attribute.
		/// </summary>
		public string Name;

		/// <summary>
		/// Nodes library asset.
		/// </summary>
		public ColladaAsset Asset;

		/// <summary>
		/// There must be at least one geometry element.
		/// </summary>
		[ColladaInstantiableCollectionAttribute]
		public List<ColladaGeometry> Geometries = new List<ColladaGeometry>();

		/// <summary>
		/// The extra element may appear any number of times.
		/// </summary>
		public List<ColladaExtra> Extras = new List<ColladaExtra>();

		#endregion

		#region ColladaXmlSerializable Overrides

		/// <summary>
		/// Read the attribute of the current XML serializable.
		/// </summary>
		/// <param name="xmlReader">
		/// A <see cref="XmlReader"/> used for reading XML element attributes.
		/// </param>
		/// <remarks>
		/// <para>
		/// This method is called only in the case there are effectively attributes on XML element. Don't expect that this
		/// method will be called even when the attributes count is zero. This is very important, since the design doesn't
		/// allow object initialization using this method.
		/// </para>
		/// </remarks>
		public override void ReadAttributes(XmlReader xmlReader)
		{
			if (xmlReader == null)
				throw new ArgumentNullException("xmlReader");

			string attribute;

			if ((attribute = xmlReader[ColladaAttributeId]) != null)
				Id = attribute;
			if ((attribute = xmlReader[ColladaAttributeName]) != null)
				Name = attribute;
		}

		/// <summary>
		/// Read an element of the current XML serializable.
		/// </summary>
		/// <param name="elementName">
		/// A <see cref="System.String"/> that specify the element name.
		/// </param>
		/// <param name="xmlReader">
		/// A <see cref="XmlReader"/> used for reading child element. It is positioned at the start element.
		/// </param>
		/// <remarks>
		/// <para>
		/// This method is responsible to read the start element of the nested element.
		/// </para>
		/// <para>
		/// This method is resposible to read all children elements till the corresponding end element, without reading it. In the
		/// case this condition is not satisfied, the XML parsing will be aborted.
		/// </para>
		/// </remarks>
		public override void ReadElement(string elementName, XmlReader xmlReader)
		{
			if (elementName == null)
				throw new ArgumentNullException("elementName");
			if (xmlReader == null)
				throw new ArgumentNullException("xmlReader");

			if (elementName == ColladaElementAsset) {
				Asset = new ColladaAsset(this);
				Asset.ReadXml(xmlReader);
			} else if (elementName == ColladaElementGeometry) {
				ColladaGeometry colladaGeometry = new ColladaGeometry(this);
				colladaGeometry.ReadXml(xmlReader);
				Geometries.Add(colladaGeometry);
			} else if (elementName == ColladaElementExtra) {
				ColladaExtra colladaExtra = new ColladaExtra(this);
				colladaExtra.ReadXml(xmlReader);
				Extras.Add(colladaExtra);
			} else
				base.ReadElement(elementName, xmlReader);
		}

		/// <summary>
		/// Collada 'library_geometries' attribute name (1.4).
		/// </summary>
		private const string ColladaAttributeId = "id";

		/// <summary>
		/// Collada 'library_geometries' attribute name (1.4).
		/// </summary>
		private const string ColladaAttributeName = "name";

		/// <summary>
		/// Collada 'library_geometries' child element name (1.4).
		/// </summary>
		private const string ColladaElementAsset = "asset";

		/// <summary>
		/// Collada 'library_geometries' child element name (1.4).
		/// </summary>
		private const string ColladaElementGeometry = "geometry";

		/// <summary>
		/// Collada 'library_geometries' child element name (1.4).
		/// </summary>
		private const string ColladaElementExtra = "extra";

		#endregion
	}

	/// <summary>
	/// The library_effects element declares a module of effect elements.
	/// </summary>
	public class ColladaLibraryEffects : ColladaInstanceLibrary<ColladaEffect>
	{
		#region Constructors

		/// <summary>
		/// Construct a ColladaLibraryEffects.
		/// </summary>
		/// <param name="parent">
		/// The parent element containing this ColladaLibraryEffects.
		/// </param>
		public ColladaLibraryEffects(ColladaXmlSerializable parent) : base(parent)
		{
			
		}

		#endregion

		#region Library Effects Information

		/// <summary>
		/// The id attribute is a text string containing the unique identifier of this element.
		/// This value must be unique within the instance document. Optional attribute.
		/// </summary>
		public string Id;

		/// <summary>
		/// The name attribute is the text string name of this element. Optional attribute.
		/// </summary>
		public string Name;

		/// <summary>
		/// Nodes library asset.
		/// </summary>
		public ColladaAsset Asset;

		/// <summary>
		/// There must be at least one effect element.
		/// </summary>
		[ColladaInstantiableCollectionAttribute]
		public List<ColladaEffect> Effects = new List<ColladaEffect>();

		/// <summary>
		/// The extra element may appear any number of times.
		/// </summary>
		public List<ColladaExtra> Extras = new List<ColladaExtra>();

		#endregion

		#region ColladaXmlSerializable Overrides

		/// <summary>
		/// Read the attribute of the current XML serializable.
		/// </summary>
		/// <param name="xmlReader">
		/// A <see cref="XmlReader"/> used for reading XML element attributes.
		/// </param>
		/// <remarks>
		/// <para>
		/// This method is called only in the case there are effectively attributes on XML element. Don't expect that this
		/// method will be called even when the attributes count is zero. This is very important, since the design doesn't
		/// allow object initialization using this method.
		/// </para>
		/// </remarks>
		public override void ReadAttributes(XmlReader xmlReader)
		{
			if (xmlReader == null)
				throw new ArgumentNullException("xmlReader");

			string attribute;

			if ((attribute = xmlReader[ColladaAttributeId]) != null)
				Id = attribute;
			if ((attribute = xmlReader[ColladaAttributeName]) != null)
				Name = attribute;
		}

		/// <summary>
		/// Read an element of the current XML serializable.
		/// </summary>
		/// <param name="elementName">
		/// A <see cref="System.String"/> that specify the element name.
		/// </param>
		/// <param name="xmlReader">
		/// A <see cref="XmlReader"/> used for reading child element. It is positioned at the start element.
		/// </param>
		/// <remarks>
		/// <para>
		/// This method is responsible to read the start element of the nested element.
		/// </para>
		/// <para>
		/// This method is resposible to read all children elements till the corresponding end element, without reading it. In the
		/// case this condition is not satisfied, the XML parsing will be aborted.
		/// </para>
		/// </remarks>
		public override void ReadElement(string elementName, XmlReader xmlReader)
		{
			if (elementName == null)
				throw new ArgumentNullException("elementName");
			if (xmlReader == null)
				throw new ArgumentNullException("xmlReader");

			if (elementName == ColladaElementAsset) {
				Asset = new ColladaAsset(this);
				Asset.ReadXml(xmlReader);
			} else if (elementName == ColladaElementEffect) {
				ColladaEffect colladaEffect = new ColladaEffect(this);
				colladaEffect.ReadXml(xmlReader);
				Effects.Add(colladaEffect);
			} else if (elementName == ColladaElementExtra) {
				ColladaExtra colladaExtra = new ColladaExtra(this);
				colladaExtra.ReadXml(xmlReader);
				Extras.Add(colladaExtra);
			} else
				base.ReadElement(elementName, xmlReader);
		}

		/// <summary>
		/// Collada 'library_effects' attribute name (1.4).
		/// </summary>
		private const string ColladaAttributeId = "id";

		/// <summary>
		/// Collada 'library_effects' attribute name (1.4).
		/// </summary>
		private const string ColladaAttributeName = "name";

		/// <summary>
		/// Collada 'library_effects' child element name (1.4).
		/// </summary>
		private const string ColladaElementAsset = "asset";

		/// <summary>
		/// Collada 'library_effects' child element name (1.4).
		/// </summary>
		private const string ColladaElementEffect = "effect";

		/// <summary>
		/// Collada 'library_effects' child element name (1.4).
		/// </summary>
		private const string ColladaElementExtra = "extra";

		#endregion
	}

	/// <summary>
	/// The library_force_fields element declares a module of force_field elements.
	/// </summary>
	public class ColladaLibraryForceFields : ColladaXmlSerializable
	{
		#region Constructors

		/// <summary>
		/// Construct a ColladaLibraryForceFields.
		/// </summary>
		/// <param name="parent">
		/// The parent element containing this ColladaLibraryForceFields.
		/// </param>
		public ColladaLibraryForceFields(ColladaXmlSerializable parent) : base(parent)
		{
			
		}

		#endregion
	}

	/// <summary>
	/// The library_images element declares a module of image elements.
	/// </summary>
	public class ColladaLibraryImages : ColladaInstanceLibrary<ColladaImage>
	{
		#region Constructors

		/// <summary>
		/// Construct a ColladaLibraryImages.
		/// </summary>
		/// <param name="parent">
		/// The parent element containing this ColladaLibraryImages.
		/// </param>
		public ColladaLibraryImages(ColladaXmlSerializable parent) : base(parent)
		{
			
		}

		#endregion

		#region Collada Library Images Information

		/// <summary>
		/// The id attribute is a text string containing the unique identifier of this element.
		/// This value must be unique within the instance document. Optional attribute.
		/// </summary>
		public string Id;

		/// <summary>
		/// The name attribute is the text string name of this element. Optional attribute.
		/// </summary>
		public string Name;

		/// <summary>
		/// Asset.
		/// </summary>
		public ColladaAsset Asset;

		/// <summary>
		/// Images composing this library.
		/// </summary>
		[ColladaInstantiableCollectionAttribute]
		public readonly List<ColladaImage> Images = new List<ColladaImage>();

		/// <summary>
		/// The extra element may appear any number of times.
		/// </summary>
		public readonly List<ColladaExtra> Extras = new List<ColladaExtra>();

		#endregion

		#region ColladaXmlSerializable Overrides

		/// <summary>
		/// Read the attribute of the current XML serializable.
		/// </summary>
		/// <param name="xmlReader">
		/// A <see cref="XmlReader"/> used for reading XML element attributes.
		/// </param>
		/// <remarks>
		/// <para>
		/// This method is called only in the case there are effectively attributes on XML element. Don't expect that this
		/// method will be called even when the attributes count is zero. This is very important, since the design doesn't
		/// allow object initialization using this method.
		/// </para>
		/// </remarks>
		public override void ReadAttributes(XmlReader xmlReader)
		{
			if (xmlReader == null)
				throw new ArgumentNullException("xmlReader");

			string attribute;

			if ((attribute = xmlReader[ColladaAttributeId]) != null)
				Id = attribute;
			if ((attribute = xmlReader[ColladaAttributeName]) != null)
				Name = attribute;
		}

		/// <summary>
		/// Read an element of the current XML serializable.
		/// </summary>
		/// <param name="elementName">
		/// A <see cref="System.String"/> that specify the element name.
		/// </param>
		/// <param name="xmlReader">
		/// A <see cref="XmlReader"/> used for reading child element. It is positioned at the start element.
		/// </param>
		/// <remarks>
		/// <para>
		/// This method is responsible to read the start element of the nested element.
		/// </para>
		/// <para>
		/// This method is resposible to read all children elements till the corresponding end element, without reading it. In the
		/// case this condition is not satisfied, the XML parsing will be aborted.
		/// </para>
		/// </remarks>
		public override void ReadElement(string elementName, XmlReader xmlReader)
		{
			if (elementName == null)
				throw new ArgumentNullException("elementName");
			if (xmlReader == null)
				throw new ArgumentNullException("xmlReader");

			if (elementName == ColladaElementAsset) {
				Asset = new ColladaAsset(this);
				Asset.ReadXml(xmlReader);
			} else if (elementName == ColladaElementImage) {
				ColladaImage colladaImage = new ColladaImage(this);
				colladaImage.ReadXml(xmlReader);
				Images.Add(colladaImage);
			} else if (elementName == ColladaElementExtra) {
				ColladaExtra colladaExtra = new ColladaExtra(this);
				colladaExtra.ReadXml(xmlReader);
				Extras.Add(colladaExtra);
			} else
				base.ReadElement(elementName, xmlReader);
		}

		/// <summary>
		/// Collada 'library_images' attribute name (1.4).
		/// </summary>
		private const string ColladaAttributeId = "id";

		/// <summary>
		/// Collada 'library_images' attribute name (1.4).
		/// </summary>
		private const string ColladaAttributeName = "name";

		/// <summary>
		/// Collada 'library_images' child element name (1.4).
		/// </summary>
		private const string ColladaElementAsset = "asset";

		/// <summary>
		/// Collada 'library_images' child element name (1.4).
		/// </summary>
		private const string ColladaElementImage = "image";

		/// <summary>
		/// Collada 'library_images' child element name (1.4).
		/// </summary>
		private const string ColladaElementExtra = "extra";

		#endregion
	}

	/// <summary>
	/// The library_lights element declares a module of light elements.
	/// </summary>
	public class ColladaLibraryLights : ColladaInstanceLibrary<ColladaLight>
	{
		#region Constructors

		/// <summary>
		/// Construct a ColladaLibraryLights.
		/// </summary>
		/// <param name="parent">
		/// The parent element containing this ColladaLibraryLights.
		/// </param>
		public ColladaLibraryLights(ColladaXmlSerializable parent) : base(parent)
		{
			
		}

		#endregion

		#region Library Lights Information

		/// <summary>
		/// The id attribute is a text string containing the unique identifier of this element.
		/// This value must be unique within the instance document. Optional attribute.
		/// </summary>
		public string Id;

		/// <summary>
		/// The name attribute is the text string name of this element. Optional attribute.
		/// </summary>
		public string Name;

		/// <summary>
		/// The library_lights element may contain an asset element.
		/// </summary>
		public ColladaAsset Asset;

		/// <summary>
		/// There must be at least one light element.
		/// </summary>
		[ColladaInstantiableCollectionAttribute]
		public readonly List<ColladaLight> Lights = new List<ColladaLight>();

		/// <summary>
		/// The extra element may appear any number of times.
		/// </summary>
		public readonly List<ColladaExtra> Extras = new List<ColladaExtra>();

		#endregion

		#region ColladaInstanceLibrary<ColladaLight> Overrides

		/// <summary>
		/// Read the attribute of the current XML serializable.
		/// </summary>
		/// <param name="xmlReader">
		/// A <see cref="XmlReader"/> used for reading XML element attributes.
		/// </param>
		/// <remarks>
		/// <para>
		/// This method is called only in the case there are effectively attributes on XML element. Don't expect that this
		/// method will be called even when the attributes count is zero. This is very important, since the design doesn't
		/// allow object initialization using this method.
		/// </para>
		/// </remarks>
		public override void ReadAttributes(XmlReader xmlReader)
		{
			if (xmlReader == null)
				throw new ArgumentNullException("xmlReader");

			string attribute;

			if ((attribute = xmlReader[ColladaAttributeId]) != null)
				Id = attribute;
			if ((attribute = xmlReader[ColladaAttributeName]) != null)
				Name = attribute;
		}

		/// <summary>
		/// Read an element of the current XML serializable.
		/// </summary>
		/// <param name="elementName">
		/// A <see cref="System.String"/> that specify the element name.
		/// </param>
		/// <param name="xmlReader">
		/// A <see cref="XmlReader"/> used for reading child element. It is positioned at the start element.
		/// </param>
		/// <remarks>
		/// <para>
		/// This method is responsible to read the start element of the nested element.
		/// </para>
		/// <para>
		/// This method is resposible to read all children elements till the corresponding end element, without reading it. In the
		/// case this condition is not satisfied, the XML parsing will be aborted.
		/// </para>
		/// </remarks>
		public override void ReadElement(string elementName, XmlReader xmlReader)
		{
			if (elementName == null)
				throw new ArgumentNullException("elementName");
			if (xmlReader == null)
				throw new ArgumentNullException("xmlReader");

			if (elementName == ColladaElementAsset) {
				Asset = new ColladaAsset(this);
				Asset.ReadXml(xmlReader);
			} else if (elementName == ColladaElementLight) {
				ColladaLight colladaLight = new ColladaLight(this);
				colladaLight.ReadXml(xmlReader);
				Lights.Add(colladaLight);
			} else if (elementName == ColladaElementExtra) {
				ColladaExtra colladaExtra = new ColladaExtra(this);
				colladaExtra.ReadXml(xmlReader);
				Extras.Add(colladaExtra);
			} else
				base.ReadElement(elementName, xmlReader);
		}

		/// <summary>
		/// Collada 'library_lights' attribute name (1.4).
		/// </summary>
		private const string ColladaAttributeId = "id";

		/// <summary>
		/// Collada 'library_lights' attribute name (1.4).
		/// </summary>
		private const string ColladaAttributeName = "name";

		/// <summary>
		/// Collada 'library_lights' child element name (1.4).
		/// </summary>
		private const string ColladaElementAsset = "asset";

		/// <summary>
		/// Collada 'library_lights' child element name (1.4).
		/// </summary>
		private const string ColladaElementLight = "light";

		/// <summary>
		/// Collada 'library_lights' child element name (1.4).
		/// </summary>
		private const string ColladaElementExtra = "extra";

		#endregion
	}

	/// <summary>
	/// The library_materials element declares a module of material elements.
	/// </summary>
	public class ColladaLibraryMaterials : ColladaInstanceLibrary<ColladaMaterial>
	{
		#region Constructors

		/// <summary>
		/// Construct a ColladaLibraryMaterials.
		/// </summary>
		/// <param name="parent">
		/// The parent element containing this ColladaLibraryMaterials.
		/// </param>
		public ColladaLibraryMaterials(ColladaXmlSerializable parent) : base(parent)
		{
			
		}

		#endregion

		#region Library Meterials Information

		/// <summary>
		/// The id attribute is a text string containing the unique identifier of this element.
		/// This value must be unique within the instance document. Optional attribute.
		/// </summary>
		public string Id;

		/// <summary>
		/// The name attribute is the text string name of this element. Optional attribute.
		/// </summary>
		public string Name;

		/// <summary>
		/// The library_materials element may contain an asset element.
		/// </summary>
		public ColladaAsset Asset;

		/// <summary>
		/// There must be at least one material element.
		/// </summary>
		[ColladaInstantiableCollectionAttribute]
		public List<ColladaMaterial> Materials = new List<ColladaMaterial>();

		/// <summary>
		/// The extra element may appear any number of times.
		/// </summary>
		public List<ColladaExtra> Extras = new List<ColladaExtra>();

		#endregion

		#region ColladaInstanceLibrary<ColladaMaterial> Overrides

		/// <summary>
		/// Read the attribute of the current XML serializable.
		/// </summary>
		/// <param name="xmlReader">
		/// A <see cref="XmlReader"/> used for reading XML element attributes.
		/// </param>
		/// <remarks>
		/// <para>
		/// This method is called only in the case there are effectively attributes on XML element. Don't expect that this
		/// method will be called even when the attributes count is zero. This is very important, since the design doesn't
		/// allow object initialization using this method.
		/// </para>
		/// </remarks>
		public override void ReadAttributes(XmlReader xmlReader)
		{
			if (xmlReader == null)
				throw new ArgumentNullException("xmlReader");

			string attribute;

			if ((attribute = xmlReader[ColladaAttributeId]) != null)
				Id = attribute;
			if ((attribute = xmlReader[ColladaAttributeName]) != null)
				Name = attribute;
		}

		/// <summary>
		/// Read an element of the current XML serializable.
		/// </summary>
		/// <param name="elementName">
		/// A <see cref="System.String"/> that specify the element name.
		/// </param>
		/// <param name="xmlReader">
		/// A <see cref="XmlReader"/> used for reading child element. It is positioned at the start element.
		/// </param>
		/// <remarks>
		/// <para>
		/// This method is responsible to read the start element of the nested element.
		/// </para>
		/// <para>
		/// This method is resposible to read all children elements till the corresponding end element, without reading it. In the
		/// case this condition is not satisfied, the XML parsing will be aborted.
		/// </para>
		/// </remarks>
		public override void ReadElement(string elementName, XmlReader xmlReader)
		{
			if (elementName == null)
				throw new ArgumentNullException("elementName");
			if (xmlReader == null)
				throw new ArgumentNullException("xmlReader");

			if (elementName == ColladaElementAsset) {
				Asset = new ColladaAsset(this);
				Asset.ReadXml(xmlReader);
			} else if (elementName == ColladaElementMaterial) {
				ColladaMaterial colladaMaterial = new ColladaMaterial(this);
				colladaMaterial.ReadXml(xmlReader);
				Materials.Add(colladaMaterial);
			} else if (elementName == ColladaElementExtra) {
				ColladaExtra colladaExtra = new ColladaExtra(this);
				colladaExtra.ReadXml(xmlReader);
				Extras.Add(colladaExtra);
			} else
				base.ReadElement(elementName, xmlReader);
		}

		/// <summary>
		/// Collada 'library_lights' attribute name (1.4).
		/// </summary>
		private const string ColladaAttributeId = "id";

		/// <summary>
		/// Collada 'library_lights' attribute name (1.4).
		/// </summary>
		private const string ColladaAttributeName = "name";

		/// <summary>
		/// Collada 'library_lights' child element name (1.4).
		/// </summary>
		private const string ColladaElementAsset = "asset";

		/// <summary>
		/// Collada 'library_lights' child element name (1.4).
		/// </summary>
		private const string ColladaElementMaterial = "material";

		/// <summary>
		/// Collada 'library_lights' child element name (1.4).
		/// </summary>
		private const string ColladaElementExtra = "extra";

		#endregion
	}

	/// <summary>
	/// The library_nodes element declares a module of node elements.
	/// </summary>
	public class ColladaLibraryNodes : ColladaInstanceLibrary<ColladaNode>
	{
		#region Constructors

		/// <summary>
		/// Construct a ColladaLibraryNodes.
		/// </summary>
		/// <param name="parent">
		/// The parent element containing this ColladaLibraryNodes.
		/// </param>
		public ColladaLibraryNodes(ColladaXmlSerializable parent) : base(parent)
		{
			
		}

		#endregion

		#region Library Node Information

		/// <summary>
		/// Nodes library identifier.
		/// </summary>
		public string Id;

		/// <summary>
		/// Nodes library name.
		/// </summary>
		public string Name;

		/// <summary>
		/// 
		/// </summary>
		public List<ColladaNode> Nodes = new List<ColladaNode>(); 

		/// <summary>
		/// Nodes library asset.
		/// </summary>
		public ColladaAsset Asset;

		#endregion

		#region ColladaXmlSerializable Overrides

		/// <summary>
		/// Read the attribute of the current XML serializable.
		/// </summary>
		/// <param name="xmlReader">
		/// A <see cref="XmlReader"/> used for reading XML element attributes.
		/// </param>
		/// <remarks>
		/// <para>
		/// This method is called only in the case there are effectively attributes on XML element. Don't expect that this
		/// method will be called even when the attributes count is zero. This is very important, since the design doesn't
		/// allow object initialization using this method.
		/// </para>
		/// </remarks>
		public override void ReadAttributes(XmlReader xmlReader)
		{
			if (xmlReader == null)
				throw new ArgumentNullException("xmlReader");

			string attribute;

			if ((attribute = xmlReader[ColladaAttributeId]) != null)
				Id = attribute;
			if ((attribute = xmlReader[ColladaAttributeName]) != null)
				Name = attribute;
		}

		/// <summary>
		/// Read an element of the current XML serializable.
		/// </summary>
		/// <param name="elementName">
		/// A <see cref="System.String"/> that specify the element name.
		/// </param>
		/// <param name="xmlReader">
		/// A <see cref="XmlReader"/> used for reading child element. It is positioned at the start element.
		/// </param>
		/// <remarks>
		/// <para>
		/// This method is responsible to read the start element of the nested element.
		/// </para>
		/// <para>
		/// This method is resposible to read all children elements till the corresponding end element, without reading it. In the
		/// case this condition is not satisfied, the XML parsing will be aborted.
		/// </para>
		/// </remarks>
		public override void ReadElement(string elementName, XmlReader xmlReader)
		{
			if (elementName == null)
				throw new ArgumentNullException("xmlReader");
			if (xmlReader == null)
				throw new ArgumentNullException("xmlReader");

			if (elementName == ColladaElementAsset) {
				Asset = new ColladaAsset(this);
				Asset.ReadXml(xmlReader);
			} else if (elementName == ColladaElementNode) {
				ColladaNode colladaNode = new ColladaNode(this);
				colladaNode.ReadXml(xmlReader);
				Nodes.Add(colladaNode);
			} else if (elementName == ColladaElementExtra) {
				XmlHelper.SkipXmlElement(xmlReader);
			} else
				XmlHelper.SkipXmlElement(xmlReader);
		}

		/// <summary>
		/// Collada 'library_images' attribute name (1.4).
		/// </summary>
		private const string ColladaAttributeId = "id";

		/// <summary>
		/// Collada 'library_images' attribute name (1.4).
		/// </summary>
		private const string ColladaAttributeName = "name";

		/// <summary>
		/// Collada 'library_images' child element name (1.4).
		/// </summary>
		private const string ColladaElementAsset = "asset";

		/// <summary>
		/// Collada 'library_images' child element name (1.4).
		/// </summary>
		private const string ColladaElementNode = "node";

		/// <summary>
		/// Collada 'library_images' child element name (1.4).
		/// </summary>
		private const string ColladaElementExtra = "extra";

		#endregion
	}

	/// <summary>
	/// The library_physics_materials element declares a module of physics_material elements.
	/// </summary>
	public class ColladaLibraryPhysicsMaterials : ColladaXmlSerializable
	{
		#region Constructors

		/// <summary>
		/// Construct a ColladaLibraryPhysicsMaterials.
		/// </summary>
		/// <param name="parent">
		/// The parent element containing this ColladaLibraryPhysicsMaterials.
		/// </param>
		public ColladaLibraryPhysicsMaterials(ColladaXmlSerializable parent) : base(parent)
		{
			
		}

		#endregion
	}

	/// <summary>
	/// The library_physics_models element declares a module of physics_model elements.
	/// </summary>
	public class ColladaLibraryPhysicsModels : ColladaXmlSerializable
	{
		#region Constructors

		/// <summary>
		/// Construct a ColladaLibraryPhysicsModels.
		/// </summary>
		/// <param name="parent">
		/// The parent element containing this ColladaLibraryPhysicsModels.
		/// </param>
		public ColladaLibraryPhysicsModels(ColladaXmlSerializable parent) : base(parent)
		{
			
		}

		#endregion
	}

	/// <summary>
	/// The library_physics_scenes element declares a module of physics_scene elements.
	/// </summary>
	public class ColladaLibraryPhysicsScenes : ColladaXmlSerializable
	{
		#region Constructors

		/// <summary>
		/// Construct a ColladaLibraryPhysicsScenes.
		/// </summary>
		/// <param name="parent">
		/// The parent element containing this ColladaLibraryPhysicsScenes.
		/// </param>
		public ColladaLibraryPhysicsScenes(ColladaXmlSerializable parent) : base(parent)
		{
			
		}

		#endregion
	}

	/// <summary>
	/// The library_visual_scenes element declares a module of visual_scene elements.
	/// </summary>
	public class ColladaLibraryVisualScenes : ColladaInstanceLibrary<ColladaVisualScene>
	{
		#region Constructors

		/// <summary>
		/// Construct a ColladaLibraryVisualScenes.
		/// </summary>
		/// <param name="parent">
		/// The parent element containing this ColladaLibraryVisualScenes.
		/// </param>
		public ColladaLibraryVisualScenes(ColladaXmlSerializable parent) : base(parent)
		{
			
		}

		#endregion

		#region Library Visual Scenes Information

		/// <summary>
		/// Nodes library identifier.
		/// </summary>
		public string Id;

		/// <summary>
		/// Nodes library name.
		/// </summary>
		public string Name;

		/// <summary>
		/// Nodes library asset.
		/// </summary>
		public ColladaAsset Asset;

		/// <summary>
		/// There must be at least one visual_scene element.
		/// </summary>
		[ColladaInstantiableCollectionAttribute]
		public List<ColladaVisualScene> VisualScenes = new List<ColladaVisualScene>();

		/// <summary>
		/// The extra element may appear any number of times.
		/// </summary>
		public List<ColladaExtra> Extras = new List<ColladaExtra>();

		#endregion

		#region ColladaXmlSerializable Overrides

		/// <summary>
		/// Read the attribute of the current XML serializable.
		/// </summary>
		/// <param name="xmlReader">
		/// A <see cref="XmlReader"/> used for reading XML element attributes.
		/// </param>
		/// <remarks>
		/// <para>
		/// This method is called only in the case there are effectively attributes on XML element. Don't expect that this
		/// method will be called even when the attributes count is zero. This is very important, since the design doesn't
		/// allow object initialization using this method.
		/// </para>
		/// </remarks>
		public override void ReadAttributes(XmlReader xmlReader)
		{
			if (xmlReader == null)
				throw new ArgumentNullException("xmlReader");

			string attribute;

			if ((attribute = xmlReader[ColladaAttributeId]) != null)
				Id = attribute;
			if ((attribute = xmlReader[ColladaAttributeName]) != null)
				Name = attribute;
		}

		/// <summary>
		/// Read an element of the current XML serializable.
		/// </summary>
		/// <param name="elementName">
		/// A <see cref="System.String"/> that specify the element name.
		/// </param>
		/// <param name="xmlReader">
		/// A <see cref="XmlReader"/> used for reading child element. It is positioned at the start element.
		/// </param>
		/// <remarks>
		/// <para>
		/// This method is responsible to read the start element of the nested element.
		/// </para>
		/// <para>
		/// This method is resposible to read all children elements till the corresponding end element, without reading it. In the
		/// case this condition is not satisfied, the XML parsing will be aborted.
		/// </para>
		/// </remarks>
		public override void ReadElement(string elementName, XmlReader xmlReader)
		{
			if (elementName == null)
				throw new ArgumentNullException("elementName");
			if (xmlReader == null)
				throw new ArgumentNullException("xmlReader");

			if (elementName == ColladaElementAsset) {
				Asset = new ColladaAsset(this);
				Asset.ReadXml(xmlReader);
			} else if (elementName == ColladaElementVisualScene) {
				ColladaVisualScene colladaVisualScene = new ColladaVisualScene(this);
				colladaVisualScene.ReadXml(xmlReader);
				VisualScenes.Add(colladaVisualScene);
			} else if (elementName == ColladaElementExtra) {
				ColladaExtra colladaExtra = new ColladaExtra(this);
				colladaExtra.ReadXml(xmlReader);
				Extras.Add(colladaExtra);
			} else
				base.ReadElement(elementName, xmlReader);
		}

		/// <summary>
		/// Collada 'library_visual_scenes' attribute name (1.4).
		/// </summary>
		private const string ColladaAttributeId = "id";

		/// <summary>
		/// Collada 'library_visual_scenes' attribute name (1.4).
		/// </summary>
		private const string ColladaAttributeName = "name";

		/// <summary>
		/// Collada 'library_visual_scenes' child element name (1.4).
		/// </summary>
		private const string ColladaElementAsset = "asset";

		/// <summary>
		/// Collada 'library_visual_scenes' child element name (1.4).
		/// </summary>
		private const string ColladaElementVisualScene = "visual_scene";

		/// <summary>
		/// Collada 'library_visual_scenes' child element name (1.4).
		/// </summary>
		private const string ColladaElementExtra = "extra";

		#endregion
	}
}
